/******************************************************************************
**                                                                           **
**                 Proprietary and Confidential Information                  **
**                                                                           **
**                 Copyright (c) Conexant Systems, Inc. Unpublished          **
**                                                                           **
** This source code and the algorithms implemented therein constitute        **
** confidential information and may compromise trade secrets of Conexant Systems,    **
** Inc. or its associates, and any unauthorized use thereof is prohibited.   **
**                                                                           **
******************************************************************************/

#ifndef _dc_scim_api_h_
#define _dc_scim_api_h_

/******************************************************************************
*  FILE FORMAT:
*      1. INCLUDES 
*      2. ENUMERATIONS 
*      3. DEFINES
*      4. STRUCTURES
*      5. GLOBALS
*      6. PRIVATE FUNCTION PROTOTYPES
*      7. FUNCTIONS
******************************************************************************/

/******************************************************************************
*  1. INCLUDES
******************************************************************************/
#include "dc_type.h"
#include "dc_return_codes.h"
#ifdef LINUX
#include "ospl.h"
#else
#include "tx_api.h"
#endif

#include "dc_scim_enum_api.h"

#include "dc_container_api.h"
#include "dc_imgbuf_api.h"
#include "dc_dmbimg_api.h"
#include "dc_conip_api.h"
#include "dc_conip_extended_api.h"
#include "dc_jpeg_api.h"

/******************************************************************************
*  2. ENUMERATIONS
******************************************************************************/

/******************************************************************************
*  3. DEFINES
******************************************************************************/
#define SCIM_DEFAULT_STACK_BYTES   (4*1024)   // thread stack
#define SCIM_SUB_STACK_BYTES       (4*1024)   // thread stack

#define SCIM_THREAD_NAME_LENGTH    12

// JPEGPIPE_api.h
//#define MAX_JPEGPIPE_FIX_MARKER_DATA_COUNT  64
//#define MIN_JPEGPIPE_MARKER_DATA_COUNT      5
//#define MAX_JPEGPIPE_MARKER_DATA_COUNT      0xFFFF  // 65535

#define MAX_SCIM_JPEG_FIX_MARKER_DATA_COUNT MAX_JPEGPIPE_FIX_MARKER_DATA_COUNT
#define MIN_SCIM_JPEG_MARKER_DATA_COUNT     MIN_JPEGPIPE_MARKER_DATA_COUNT
#define MAX_SCIM_JPEG_MARKER_DATA_COUNT     MAX_JPEGPIPE_MARKER_DATA_COUNT

/******************************************************************************
*  4. STRUCTURES
******************************************************************************/
typedef struct {
#ifdef LINUX	
  OSPL_THREAD control;
#else
  TX_THREAD control;
#endif  
  char name[SCIM_THREAD_NAME_LENGTH];
  UINT32 stack[SCIM_DEFAULT_STACK_BYTES/4];
} DC_SCIM_THREAD_t;

typedef struct {
#ifdef LINUX	
  OSPL_THREAD control;
#else
  TX_THREAD control;
#endif 
  UINT32 stack[SCIM_SUB_STACK_BYTES/4];
} DC_SCIM_SUB_THREAD_t;

typedef struct {
  UINT32 p_address;
  UINT32 up_address;

  UINT32 p_left;
  UINT32 up_left;

  // page data
  // op date
  // halftone data

  UINT32 int_imgbuf_size;

  UINT32 jpeg_p_size;
  UINT32 jpeg_up_size;
} SCIM_MEM_INFO_t;

typedef struct {
  DC_MEM_PARAMS_t memParams;
  UINT32 memProvided;

  UINT32 n_max_width;
  UINT32 n_max_height;
  UINT32 n_max_colors;
	UINT32 n_max_dmbs;
	UINT32 jpeg_output;

  SCIM_MEM_INFO_t mem_info;

  UINT32 out_imgbuf_mem_address;
  UINT32 out_imgbuf_mem_size;

} SCIM_SETUP_PARAMS_t;

struct DC_SCIM_CONTEXT_STRUCT
{
  DC_SCIM_STATUS_t status;
  DC_SCIM_ERROR_t  error;
  DC_SCIM_THREAD_t thread;
  DC_SCIM_SUB_THREAD_t sub_thread;
  UINT32 signature;
#ifdef LINUX
  OSPL_EVENT_FLAGS_GROUP eventflags;
  OSPL_EVENT_FLAGS_GROUP sub_eventflags;
#else
  TX_EVENT_FLAGS_GROUP eventflags;
  TX_EVENT_FLAGS_GROUP sub_eventflags;
#endif  

  void (*callback)(void *arg, DC_SCIM_EVENT_t event, DC_SCIM_ERROR_t error);
  void *callback_arg;

	UINT32 cache_bytes_size;
	UINT32 cache_bytes_base;
	UINT32 noncache_bytes_size;
	UINT32 noncache_bytes_base;

  SCIM_SETUP_PARAMS_t setup_params;

  void *p_page_data;
  void *p_op_data;

  UINT32 calls_flag;
  UINT32 on_request;
};

typedef struct DC_SCIM_CONTEXT_STRUCT DC_SCIM_CONTEXT_t;

/******************************************************************************
*  5. GLOBALS
******************************************************************************/

/******************************************************************************
*  6. FUNCTION PROTOTYPES
******************************************************************************/


/*****************************************************************************/
/*  @brief      for client to begin set-up of scim work
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_setup_begin
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_setup_begin
 (DC_SCIM_CONTEXT_t *pContext);

/*****************************************************************************/
/*  @brief      for client to set max output
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_setup_max_output_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure 
 *  @param      n_max_width - max output width
 *  @param      n_max_height - max output height
 *  @param      n_max_colors - the max number of output components
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_setup_max_output_set
 (DC_SCIM_CONTEXT_t *pContext,
  UINT32 n_max_width,
  UINT32 n_max_height,
  UINT32 n_max_colors);

/*****************************************************************************/
/*  @brief      for client to set max #dmbs
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_setup_max_dmbs_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure 
 *  @param      n_max_dmbs - max # of dmbs
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_setup_max_dmbs_set
 (DC_SCIM_CONTEXT_t *pContext,
  UINT32 n_max_dmbs);


/*****************************************************************************/
/*  @brief      for client to set jpeg info
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_setup_jpeg_info_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      jpeg_output - TRUE if jpeg output
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_setup_jpeg_info_set
 (DC_SCIM_CONTEXT_t *pContext,
  boolean jpeg_output,
  UINT32 reserved);


/*****************************************************************************/
/*  @brief      for client to finish set-up of scim work
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_setup_end
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      pMemParams - pointer to DC_MEM_PARAMS_t structure
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_setup_end
 (DC_SCIM_CONTEXT_t *pContext,
  DC_MEM_PARAMS_t *pMemParams);

/*****************************************************************************/
/*  @brief      for client to create and start a SCIM thread
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_create
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      name - pointer to thread name string
 *  @param      priority - Thread priority
 *  @param      callback - function pointer to callback
 *  @param      callback_arg - pointer to first argument of callback
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_create
 (DC_SCIM_CONTEXT_t *pContext,
  char *name,
  DC_MEM_PARAMS_t *pMemParams,
  DC_THREAD_PRIORITY priority,
  void (*callback)(void *arg, DC_SCIM_EVENT_t event, DC_SCIM_ERROR_t error),
  void *callback_arg);


/*****************************************************************************/
/*  @brief      for client to delete the SCIM thread
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_delete
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_delete
 (DC_SCIM_CONTEXT_t *pContext);

/*****************************************************************************/
/*  @brief      for client to specify memory of SCIM
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_memory_specify
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      pMemParams - pointer to DC_MEM_PARAMS_t structure
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_memory_specify
 (DC_SCIM_CONTEXT_t *pContext,
  DC_MEM_PARAMS_t *pMemParams);


/*****************************************************************************/
/*  @brief      for client to begin a page configuration of SCIM work
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_init
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_init
 (DC_SCIM_CONTEXT_t *pContext);

/*****************************************************************************/
/*  @brief      for client to complete page configuration and launch page processing.
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_start
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      p_output - pointer to output data container
 *  @param      type - type of output data container
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_start
 (DC_SCIM_CONTEXT_t *pContext,
  void *p_output,
	DC_SCIM_OUTPUT_CONTAINER_TYPE_t type);

/*****************************************************************************/
/*  @brief      for client to tell SCIM completion of use of page
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_done
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      p_page_container - pointer to data container
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_done
 (DC_SCIM_CONTEXT_t *pContext,
  void *p_page_container);

/*****************************************************************************/
/*  @brief      for client to cancel page processing of the SCIM thread
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_cancel
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_cancel
 (DC_SCIM_CONTEXT_t *pContext);

/*****************************************************************************/
/*  @brief      for client to get the status of scim page processing
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_status_get
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      status - pointer to datum the status returns
 *  @param      error - pointer to datum the error retunrs
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_status_get
 (DC_SCIM_CONTEXT_t *pContext,
  DC_SCIM_STATUS_t *status,
  DC_SCIM_ERROR_t  *error);

/*****************************************************************************/
/*  @brief      for client to specify input
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_input_data_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      enable - TRUE to enable, otherwise FALSE
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_pipeline_set
 (DC_SCIM_CONTEXT_t *pContext,
	boolean enable);

/*****************************************************************************/
/*  @brief      for client to specify input
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_input_data_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      p_imgbuf - pointer to input DC_IMGBUF
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_input_data_set
 (DC_SCIM_CONTEXT_t *pContext,
	DC_IMGBUF *p_imgbuf);

/*****************************************************************************/
/*  @brief      for client to enable defringing with input data of channel
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_defringing_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      input_channel_no - applied channel number of input
 *  @param      param1,2,3 - defringing paramrters
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_defringing_set
 (DC_SCIM_CONTEXT_t *pContext,
  UINT32 input_channel_no,
	INT32 param1, INT32 param2, INT32 param3);

/*****************************************************************************/
/*  @brief      for client to specify input
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_scale_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      output_width - define the output width
 *  @param      input_height - define scale of height with a pair of input and output
 *  @param      output_height
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_scale_set
 (DC_SCIM_CONTEXT_t *pContext,
	UINT32 output_width,
	UINT32 input_height,
	UINT32 output_height);

/*****************************************************************************/
/*  @brief      for client to specify the output format
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_format_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      format - define the format of output {S_RAW, LLJ, JPEG, SIMPLE, MH,MR,MMR,JBIG}
 *  @param      bitdepth - define the bitdepth of output {1, 8, 16}
 *  @param      channel - define the channels of output {1, 3}
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_format_set
 (DC_SCIM_CONTEXT_t *pContext,
	DC_IMAGE_FORMAT format,
	DC_IMAGE_BITDEPTH bitdepth,
	DC_IMAGE_CHANNELS channel);

/*****************************************************************************/
/*  @brief      for client to specify the halftone mode 
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_halftone_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      mode - define the halftone mode { TRESHOLD, ERROR DIFFUSION, DITHER}
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_halftone_set
 (DC_SCIM_CONTEXT_t *pContext,
  DC_SCIM_HALFTONE_MODE_t mode,
  UINT32 reserve1, UINT32 reserve2);

/*****************************************************************************/
/*  @brief      for client to specify the color space conversion
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_csc_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      p_csc_table - pointer to custom color space conversion tbl.
 *  @param      jpeg_csc_eanble - TRUE for JPEG default csc conversion with jpeg output
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_csc_set
 (DC_SCIM_CONTEXT_t *pContext,
	DC_CONIP_CSC_TABLE_DATA *p_csc_table,
  boolean jpeg_csc_eanble);

/*****************************************************************************/
/*  @brief      for client to set tonal response curve (TRC) tables
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_trc_table_set
 *
 *  @output     none
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      table - pointer to arrays of TRC table, *table[3]
 *                      one table consists of 65 entries.
 *  @param      trc_after_csc - TRUE if trc is performed after color space converison.
 *                      one table consists of 65 entries.
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_trc_table_set
 (DC_SCIM_CONTEXT_t *pContext, UINT8 *trc[3], boolean trc_after_csc);

/*****************************************************************************/
/*  @brief      for client to set dither table
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_dither_set
 *
 *  @output     none
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      channel_no - output channel index
 *  @param      width - the width of dither kernel in pixel, {1, 128}
 *  @param      height - the height of dither kernel in line, {1, 128}
 *  @param      data - pointer to dither raster data from top and left
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_dither_set
(DC_SCIM_CONTEXT_t *pContext,
 UINT32 channel_no, UINT32 width, UINT32 height, UINT8 *data);

/*****************************************************************************/
/*  @brief      for client to specify the memory of output the type of which is DC_IMGBUF
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_output_memory_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      p_csc_table - pointer to custom color space conversion tbl.
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_output_memory_set
 (DC_SCIM_CONTEXT_t *pContext,
	UINT32 address,
	UINT32 size);

/*****************************************************************************/
/*  @brief      for client to specify sample mode of encode
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_sample_mode_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      sample_mode - encode sample mode
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_jpeg_sample_mode_set
 (DC_SCIM_CONTEXT_t *pContext, 
  DC_SCIM_JPEG_SAMPLE_MODE_t sample_mode);

/*****************************************************************************/
/*  @brief      for client to specify quantization level of encode
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_quant_level_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      quant_level - encode quantization level
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_jpeg_quant_level_set
 (DC_SCIM_CONTEXT_t *pContext, 
  DC_SCIM_JPEG_QUANT_LEVEL_t quant_level);

/*****************************************************************************/
/*  @brief      for client to specify restart interval of RST for encode
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_restart_interval_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      restart_interval_mcu_lines - # of MCU-lines
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_jpeg_restart_interval_set
 (DC_SCIM_CONTEXT_t *pContext, 
  UINT32 restart_interval_mcu_lines);

/*****************************************************************************/
/*  @brief      for client to specify application marker to insert in for encode
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_app_marker_set
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      marker_data - pointer to marker data 
 *  @param      n_marker_bytes - # of app marker data including marker&length
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_jpeg_app_marker_set
 (DC_SCIM_CONTEXT_t *pContext,
  UINT8 *marker_data,
  UINT32 n_marker_bytes);

/*****************************************************************************/
/*
 *  @ingroup    SCIM
 *  @b function dc_scim_page_prapi_set
 *
 *  @param      pContext - pointer to DC_RIP_CONTEXT_t structure
 *  @param      enable - 
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_prapi_set
 (DC_SCIM_CONTEXT_t *pContext,
  boolean enable);

/*****************************************************************************/
/*  @brief      for client to set fir
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_fir_set
 *
 *  @output     none
 *
 *  @param      width - the width of fir kernel 
 *  @param      height - the height of fir kernel
 *  @param      shift_count - count for result to be left shifted
 *  @param      tap - pointer to tap values from tap notation A (center tap)
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_fir_set
(DC_SCIM_CONTEXT_t *pContext,
 UINT32 width, UINT32 height, UINT32 shift_count, INT8 *tap);

/*****************************************************************************/
/*  @brief      for client to set fir for one of two context fir.
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_fir_extended_set
 *
 *  @output     none
 *
 *  @param      context_index - {0,1}, context 1 may not be available.
 *  @param      is_alternate - if set, fir to apply to last two components
 *  @param      width - the width of fir kernel 
 *  @param      height - the height of fir kernel
 *  @param      shift_count - count for result to be left shifted
 *  @param      tap - pointer to tap values from tap notation A (center tap)
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_fir_extended_set
(DC_SCIM_CONTEXT_t *pContext,
 UINT32 context_index, 
 UINT32 is_alternate,
 UINT32 width, UINT32 height, UINT32 shift_count, INT8 *tap);

/*****************************************************************************/
/*  @brief      for client to set fir options
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_fir_options_set
 *
 *  @output     none
 *
 *  @param      fir_options - OR'ed of SCIM_FIR_OPTIONS_t fields.
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_fir_options_set
(DC_SCIM_CONTEXT_t *pContext,
 SCIM_FIR_OPTIONS_t fir_options);

/*****************************************************************************/
/*  @brief      for client to set level adjustment parameters
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_level1_set
 *
 *  @output     none
 *
 *  @param      contrast - one of enum SCIM_CONTRAST_t
 *  @param      brightness - in range of {-127, 127}
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_level1_set 
(DC_SCIM_CONTEXT_t *pContext,
 SCIM_CONTRAST_t contrast, INT32 brightness);

/*****************************************************************************/
/*  @brief      for client to set level adjustment parameters
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_level2_set
 *
 *  @output     none
 *
 *  @param      white_guard - offset to white level, {0, 127}
 *  @param      black_guard - offset to black level, {0, 127}
 *  @param      white_clip - code region to be clipped to white, 
 *                           no clipping if 0
 *  @param      black_clip - (255- code region) to be clipped to black,
 *                            no clipping if 0
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_level2_set 
(DC_SCIM_CONTEXT_t *pContext,
 UINT32 white_guard, UINT32 black_guard, UINT32 white_clip, UINT32 black_clip);

/*****************************************************************************/
/*  @brief      for client to set level adjustment parameters
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_level3_set
 *
 *  @output     none
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      adjust_control
 *  @param      n_top_lines - {0, 255}
 *  @param      initial_white_level - {0, 127} ie integer value of 23-bits:7.16
 *  @param      white_sensitivity - {0, 31}
 *  @param      black_sensitivity - {0, 31}
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_level3_set 
(DC_SCIM_CONTEXT_t *pContext,
 SCIM_ADJUST_CONTROL_t adjust_control, UINT32 n_top_lines, UINT32 initial_white_level, 
 UINT32 white_sensitivity, UINT32 black_sensitivity);

/*****************************************************************************/
/*  @brief      for client to specify FAX related compression parameters
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_fax_parameter_set
 *
 *  @output     none
 *
 *  @param      pContext - pointer to DC_SCIM_CONTEXT_t structure
 *  @param      stripe_size - stripe size for JBIG and MR, or K factor for MMR
 *  @param      min_bytes - minimum (16-bit) # of encoded bytes per line for SIMPLE,MH,MR,MMR 
 *  @param      reserve1 
 *  @param      reserve2 
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_fax_parameter_set
 (DC_SCIM_CONTEXT_t *pContext,
  UINT32 stripe_size, UINT32 min_bytes, UINT32 reserve1, UINT32 reserve2);

/*****************************************************************************/
/*  @brief      for client to set one mode of LLJ
 *
 *  @ingroup    SCIM
 *  @b function dc_scim_page_llj_compression_mode_set
 *
 *  @output     none
 *
 *  @param      mode - compression mode {0, 9}
 *
 *  @return     DC_SUCCESS, DC_FAILURE, DC_BAD_ARGUMENT
 *
 *****************************************************************************/
DC_RETURN_CODE dc_scim_page_llj_compression_mode_set 
(DC_SCIM_CONTEXT_t *pContext, UINT32 mode);

DC_RETURN_CODE dc_scim_page_color_invert 
(DC_SCIM_CONTEXT_t *pContext);

#endif


